package phoenix.core.base.extensions;

import core.helpers.JavaScriptHelper;
import org.testng.TestException;

import phoenix.core.PhoenixManager;
import phoenix.core.helpers.extensions.DBHelperExt;
import phoenix.core.helpers.extensions.LoggerHelperExt;

/**
 * Base class for all pages.
 * Contains the commonly used methods.
 */
public class PageBaseExt
{
	// PhoenixManager instance
	protected static PhoenixManager manager;

	/**
	 * Initializes PageBase
	 * 
	 * @param p_manager PhoenixManager instance
	 */
	public PageBaseExt(PhoenixManager p_manager)
	{
		manager = p_manager;
	}

	/**
	 * Link method to DBHelperExt
	 * 
	 * @return DBHelperExt instance
	 */
	public DBHelperExt db()
	{
		return manager.db();
	}

	public JavaScriptHelper js()
	{
		return manager.js();
	}

	/**
	 * Link method to LoggerHelperExt
	 * 
	 * @return LoggerHelperExt instance
	 */
	public LoggerHelperExt log()
	{
		return manager.log();
	}

	public void testExeption(String p_error)
	{
		log().info("ERROR: TEST EXCEPTION: " + p_error);
		throw new TestException(p_error);
	}
}